import { FlowFileType, FlowFileBelong } from '@prisma/client'
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'

export class FlowFile {
  static ApiPropertyEnum = {
    FlowFileType: [`${FlowFileType.Image}--图片`],
    FlowFileBelong: [`${FlowFileBelong.System}--系统内置`, `${FlowFileBelong.Platform}--平台自定义`],
  }

  @ApiProperty({ description: 'ID', type: Number })
  id: number

  @ApiProperty({ description: '标题', type: String })
  label: string

  @ApiProperty({ description: 'URL地址', type: String })
  url: string

  @ApiProperty({ description: '文件类型', enum: FlowFile.ApiPropertyEnum.FlowFileType })
  type: FlowFileType

  @ApiProperty({ description: '文件归属', enum: FlowFile.ApiPropertyEnum.FlowFileBelong })
  belong: FlowFileBelong

  @ApiProperty({ description: '创建时间', type: Date })
  createTime: Date

  @ApiProperty({ description: '所属平台', type: String })
  platform: string

  @ApiPropertyOptional({ description: '所属平台下的项目', type: String })
  project?: string

  @ApiProperty({ description: '分组名称', type: String })
  groupLabel: string

  @ApiPropertyOptional({ description: '排序号，降序', type: Number })
  sortNo?: number
}
